Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added invoke option to the command #968

Merged
merged 5 commits into from
Nov 15, 2019
Merged

Added invoke option to the command #968

merged 5 commits into from
Nov 15, 2019

Conversation

syrusakbary
Copy link
Member

@syrusakbary syrusakbary commented Nov 14, 2019

Description

This PR adds an --invoke to the Wasmer CLI

Review

  • Add a short description of the the change to the CHANGELOG.md file

@nlewycky
Copy link
Contributor

Why invoke and not -e for entry?

@@ -132,6 +132,10 @@ struct Run {
)]
backend: Backend,

/// Invoke a specified function
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe "specify the name of the start function" or "of the main function" of something like that?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is not a main function, but a raw function that you might want to invoke.

@bjfish
Copy link
Contributor

bjfish commented Nov 14, 2019

It would be nice if this could take integer parameters like --invoke fun_name 2,3,4 ... this was also previously suggested to be a separate command wasmer invoke fun_name 2,3,4, and to print the result.

@syrusakbary
Copy link
Member Author

@nlewycky

Why invoke and not -e for entry?

It's not an entry function. But a function that you might want to call it alone. In general I'm following the naming of other implementations

@bjfish

It would be nice if this could take integer parameters like --invoke fun_name 2,3,4 ... this was also previously suggested to be a separate command wasmer invoke fun_name 2,3,4, and to print the result.

Right now it will take the arguments provided in the CLI (transformed to the necessary i32, i64, ... values). Such as:

wasmer run myfile.wasm --invoke fun 1 2 3

@@ -132,6 +132,10 @@ struct Run {
)]
backend: Backend,

/// Invoke a specified function
#[structopt(long = "invoke", short = "i")]
invoke: Option<String>,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⛳️

Consider:

#[structopt(long = "invoke", short = "i", default = "main")]
invoke: String

This is less flexible, but for the code as it is now, this is a cleaner solution

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't like that much, because depending on the integration you use (emscripten, wasi, ...) the default might vary. Will go through the other approach

src/bin/wasmer.rs Show resolved Hide resolved
@syrusakbary
Copy link
Member Author

bors r+

bors bot added a commit that referenced this pull request Nov 15, 2019
968: Added invoke option to the command r=syrusakbary a=syrusakbary

# Description 

This PR adds an `--invoke` to the Wasmer CLI

<!-- 
Provide details regarding the change including motivation,
links to related issues, and the context of the PR.
-->

# Review

- [x] Add a short description of the the change to the CHANGELOG.md file


Co-authored-by: Syrus <[email protected]>
@bors
Copy link
Contributor

bors bot commented Nov 15, 2019

Build succeeded

  • wasmerio.wasmer

@bors bors bot merged commit 3d36360 into master Nov 15, 2019
@bors bors bot deleted the invoke branch November 15, 2019 22:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants